package com.snopy.thread.thread_base;

import lombok.extern.slf4j.Slf4j;

import java.sql.Time;
import java.util.concurrent.TimeUnit;

/**
 * @author snopy
 * @version 1.0.0
 * @classname DaemonThreadTest
 * @description
 * @email 77912204@qq.com
 * @date 2022/02/20 21:35
 */
@Slf4j
public class DaemonThreadTest {
    public static void main(String[] args) {
        Thread thread = new Thread(()->{
            try {
                log.info("deamon线程开始执行~~");
                TimeUnit.SECONDS.sleep(10);

            } catch (InterruptedException e) {
                e.printStackTrace();
            }finally {
                log.info("deamon线程执行结束~~");
            }
        },"DeamonThread");
        thread.setDaemon(true);
        thread.start();
        log.info("main方法执行结束");
    }

}


